<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
<script>

    function Parent(m){
        this.msg = m;
    }
    Parent.prototype.init = function(){
        console.log(this.msg)
    }

    function Child(m){
        Parent.call(this, m)
    }
    Child.prototype = {
        ...Parent.prototype,
        init(){
            console.log("这是child的init")
        }
    }
    
    const p = new Parent("hello");
    console.log(p)
    p.init();
    console.log(p.init);
    
    const c = new Child("world");
    console.log(c)
    console.log(c.init);
    c.init();
    
</script>
</html>